/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import com.sun.lwuit.Form;
import com.sun.lwuit.Command;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.layouts.BoxLayout;

/**
 *
 * @author Kvest
 */
public class LoadForm extends Form implements ActionListener
{
    public static final int EMPTY_ID = 1;
    public static final int LOAD_ID = 1;
    
    private Command load;
    private FormAction listener;

    public LoadForm(FormAction listener)
    {
        super("");
        this.listener = listener;

        init();
    }

    private void init()
    {
        setLayout(new BoxLayout(BoxLayout.Y_AXIS));

        addCommandListener(this);

        //addCommand(new Command(" ",EMPTY_ID));
        load= new Command("Загрузить", LOAD_ID);
        addCommand(load);

        TextArea text = new TextArea("Найдена новая версия и она сейчас будет загружена с сервера!", 1, 30);
        text.setAlignment(TextArea.LEFT);
        text.setEditable(false);
        addComponent(text);
    }

    public void actionPerformed(ActionEvent evt)
    {
        if (listener != null)
        {
            listener.commandAction(evt.getCommand().getId());
        }
    }
}
